package com.currentbp.test.java8.myFunctionInterface;

import com.alibaba.fastjson2.JSON;
import com.currentbp.common.model.Student;
import com.currentbp.common.model.Teacher;

/**
 * @author baopan
 * @createTime 2024-11-19 17:16:44
 */
public class StudentFinishWork {

    public Teacher doFinishWork(MyFunInterface<Teacher, Student> myFunInterface, Student student) {
        //此处可以做一些准备工作
        Teacher teacher = myFunInterface.doMyFunction(student);
        //此处可以做一些收尾工作
        return teacher;
    }

    public void customFinishWork() {
        Teacher teacher = doFinishWork((tempStudent) -> {
            //此处是用户自定义的功能区域
            Teacher teacher1 = new Teacher(11 + tempStudent.getId(), "11_" + tempStudent.getName());
            return teacher1;
        }, new Student(1, "1"));

        System.out.println("=====>" + JSON.toJSONString(teacher));
    }

    public static void main(String[] args) {
        StudentFinishWork studentFinishWork = new StudentFinishWork();
        studentFinishWork.customFinishWork();
    }
}
